chcp 65001
set dir=%1
set "dir=%dir:"= %"
:loop
for /f "tokens=1* delims=\/:*?<>|" %%a in ("%dir%") do (
   if %%b. neq . set "dir=%%a %%b"&goto loop
)
echo "%dir%">%2
